package com.sky.controller.user;

import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.SetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/setmeal")
@Slf4j
public class steamlController {
    @Autowired
    private SetmealService steamlService;


    /**
     * 根据categoryid查询套餐(steamlid)信息
     */
    @GetMapping("/list")
    @Cacheable(value = "setmealCache", key = "#categoryId")
    public Result<List<Setmeal>> getSteamlList(Long categoryId){
        Setmeal setmeal = new Setmeal();
        setmeal.setCategoryId(categoryId);
        setmeal.setStatus(1);
        List<Setmeal> list = steamlService.list(setmeal);
        return Result.success(list);
    }

}
